package MementoMod;

import MementoMod.code.CareTaker;
import MementoMod.code.TextEditor;

// 客户端类
public class Client {
    public static void main(String[] args) {
        code code = new code();
        CareTaker careTaker = code.new CareTaker();
        TextEditor textEditor = code.new TextEditor(careTaker);

        textEditor.setState("State 1");
        textEditor.setState("State 2");
        textEditor.setState("State 3");

        System.out.println("Current State: " + textEditor.getState()); // State 3

        textEditor.undo();
        System.out.println("State after undo: " + textEditor.getState()); // State 2

        textEditor.redo();
        System.out.println("State after redo: " + textEditor.getState()); // State 3

        textEditor.undo();
        System.out.println("State after undo: " + textEditor.getState()); // State 2

        textEditor.undo();
        System.out.println("State after undo: " + textEditor.getState()); // State 1

    }
}